package cn.maihe.elg.operation.service.invoice;

import cn.maihe.elg.operation.repository.entity.SellerInfoDO;
import cn.maihe.elg.operation.repository.entity.SellerInfoVo;
import cn.maihe.elg.operation.service.BaseDaoService;
import cn.maihe.framework.starter.base.sql.PageBo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @Description 销方信息服务
 * @Author WJH
 * @Date 2021/03/25
 */
@Service
public class SellerInfoService extends BaseDaoService<SellerInfoDO> {


    public PageBo<SellerInfoDO> selectPageBySql(int pageNo, int pageSize, String gmtCreateRange, SellerInfoVo vo) {
        Map<String, Object> paramsMap = toMapAndAddParams(vo);
        if (StringUtils.isNotBlank(gmtCreateRange)) {
            String[] rangeAy = gmtCreateRange.split(",");
            if (rangeAy.length > 1) {
                paramsMap.put("startGmtCreate", rangeAy[0]+" 00:00:00");
                paramsMap.put("endGmtCreate", rangeAy[1]+" 23:59:59");
            }
        }
        return this.selectPageBySql("selectSellerList", "selectSellerCount", paramsMap, pageNo, pageSize);
    }

}
